<template>
  <div class="content">
    <div>
      <van-nav-bar
        title="绑定手机号"
        left-text="返回"
        left-arrow
        @click-left="onClickLeft"
      />
    </div>
    <div class="info">
      <!-- 输入密码 -->
      <van-cell title="原手机号"  >
         <template #title>
           <span>原手机号</span>
           <span style="margin-left: 38px">1889966666</span>
         </template>
      </van-cell>
      <van-field v-model="NewPassword"  label="新手机号" placeholder="请输入新手机号"/>

        <van-field
          v-model="sms"
          center
          clearable
          label="短信验证码"
          placeholder="请输入短信验证码"
        >
          <template #button>
            <van-button size="small" type="default">发送验证码</van-button>
          </template>
        </van-field>
      <van-field v-model="EnterPassword" type="password" label="登录密码" placeholder="请输入登录密码" />
      <div class="tips">
        <p class="title">温馨提示：</p>
        <p class="content">设置/变更手机号后，密码可通过新绑定的手机号找回</p>
      </div>
      <div class="word">

          PS：如果为新绑定手机号，则不显示第一行的原手机号。
          如果原来绑定过，则显示，此时为换绑。换绑的时候，新
          手机号不能绑定其他账号。

      </div>
    </div>


    <div class="BtnEventName">
      <van-button type="info" style="width:345px;" @click="save">确定</van-button>
    </div>

  </div>
</template>
<script>
  import registerCode from "@/components/code"
  export default {

    components:{
      registerCode
    },
    data() {
      return {
        Password: '',
        NewPassword:'',
        EnterPassword:'',
        password:'',
        sms:'',
        code:'',
      };
    },
    mounted(){
      this.resetCode();
    },
    methods: {
      //路由跳转
      onClickLeft() {
        this.$router.push({path:'set'})
      },
      //验证吗
      resetCode(){
        this.code="";
        const codeList="zxcvbnmasdfghjklqwertyuiop1234567890";
        for(let i= 0; i<4;i++){
          let random =  Math.floor((Math.random() * codeList.length) + 0);
          this.code+=codeList[random]
        }
      },
      save(){
        this.$router.push({path:'set'})
      }
    },
  };
</script>

<style scoped>
  .content{
    height: 100%;
    background-color: #f7f7f7;
  }
  .info{
    margin-top: 20px;
  }
  .nav{
    width: 345px;
    height: 18px;
    margin-left: 15px;
    top: 223px;
    color: rgba(80, 80, 80, 1);
    font-size: 10px;
    line-height: 150%;
    text-align: left;
  }
  .BtnEventName{
    color: rgba(255, 255, 255, 1);
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    margin-top: 92px;
  }
  .tips p{
    margin: 0;
  }
  .tips{
    padding: 0 15px;

  }
  .tips .title{
    margin-top: 10px;
    color: rgba(255, 141, 26, 1);
    font-size: 12px;
  }
  .tips .content{
    margin-top: 2px;
    color: rgba(80, 80, 80, 1);
    font-size: 12px;
  }
  .word{
    margin-top: 60px;
    padding: 0 15px;
    color: rgba(80, 80, 80, 1);
    font-size: 14px;
    font-style: italic;

  }
</style>
